<!DOCTYPE html>
<html lang="en">

<head>
    <!--[if lte IE 9]>
    <div class="lowIE">
        温馨提示：您目前的ie浏览器版本过低，网站部分功能无法正常使用，建议尽快升级或者更换其他浏览器：
        <a href="http://www.chromeliulanqi.com/" target="_blank">点击推荐下载</a>
    </div>
    <![endif]-->
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <title>智慧灯控平台</title>
    <link rel="shortcut icon" href="/frame/login/img/logonew.png" type="image/x-icon" />
    <link rel="stylesheet" href="/system/common/libs/bootstrap/css/bootstrap.min.css">
    <!--<link rel="stylesheet" type="text/css" href="/frame/css/other.css" class="css-href"/>-->
    <link rel="stylesheet" href="/frame/login/css/login.css">
    <style>
        body {
            width: 100%;
            background: url(/frame/login/img/bg.jpg) bottom no-repeat;
            /*height: calc(100% - 150px);*/
            background-size: cover;
        }
        .body {
            background: none;
        }
        .header{
            background-color: transparent!important;
            color: #fff;
        }
        .header .logo {
            color: #c4c4c4;
        }
        .footer {
            background: transparent;
        }
        .body-container>form {
            left: 50%;
            margin-left: -175px;
        }


        .loginbody {
            height: 100vh;
            width: 100%;
            background: url('/frame/login/img/bgsvg.svg')
        }
        .login-wrap {
            height: 100%;
            width: 100%;
        }

        .login-wrap-box {
            position: absolute;
            top: 0;
            right: 0;
            left: 0;
            bottom: 0px;
            width: 600px;
            margin: 80px auto;
            padding: 0 60px;
            color: #76838f;
        }

        .login-wrap-box-pre {
            vertical-align: middle;
            display: inline-block;
            max-width: 100%;
            font-size: 14px;
            padding: 30px 50px 50px 50px;
            border-radius: 5px;
            background: rgba(255, 255, 255, 0.6);
        }


        .login-wrap-box-pre .smalltitle {
            line-height: 1.2;
            color: #37474f;
            font-size: 20px;
            margin-top: 20px;
            margin-bottom: 25px;
        }

        .login-wrap-box-pre .smalltext {
            margin: 0 0 11px;
            font-size: 14px;
        }

        .logininput {
            margin-top: 20px;
        }

        .logininput-box {
            position: relative;
            margin-bottom: 12px;
            box-sizing: border-box;
            border: 1px solid #e4eaec;
            border-radius: 3px;
        }

        .logininput-box input {
            padding-right: 40px;
            height: 32px !important;
            display: block;
            width: 100%;
            height: 32px;
            padding: 4px 12px;
            font-size: 14px;
            line-height: 1.6;
            color: #76838f;
            background-color: rgba(255, 255, 255, .6);
            outline: 0;
            overflow: hidden;
            width: 350px;
            border: 0;
        }

        .logininput-box-btn {
            font-size: 14px;
            line-height: 1.6;
            border-radius: 3px;
            text-align: center;
            color: #fff;
            background-color: #62a8ea;
            border-color: #62a8ea;
            padding: 8px 0;
            overflow: inherit;
            margin-top: 30px;
            cursor: pointer;
        }

        .logininput-box img {
            position: absolute;
            right: 0px;
            top: 0;
            height: 100%;
            border-left: solid 1px #e4eaec;
            cursor: pointer;
        }
        .login-wrap {
            background: none;
        }
        .login-wrap-box:before {
            display: inline-block;
            height: 100%;
            vertical-align: middle;
            content: "";
        }
        .smalltitle img {
            width: 50px;
            margin-right: 20px;
            margin-top: -5px;
        }
        .headertip {
            position: absolute;
            left: 100px;
            top: 30px;
            font-size: 30px;
            font-weight: 800;
            color: rgba(0, 0, 0, .6);
        }
        .headertip img {
            margin-right: 20px;
        }
    </style>
</head>

<body>
<!--<div class="header">-->
    <!--<div class="logo">-->
        <!--<span style="display: inline-block; margin-right: 10px" ><img src="/frame/login/img/logonew.png"/></span>-->
        <!--渝兴建设工程项目管理平台-->
        <!--&lt;!&ndash;<span style="font-size: 14px;text-shadow: none">v2.0</span>&ndash;&gt;-->
    <!--</div>-->
<!--</div>-->

<h3 class="headertip"><img src="/frame/login/img/logonew.png" alt="">智慧灯控平台</h3>
<div class="body">
    <div class="loginbody">
        <div class="login-wrap">
            <div class="login-wrap-box">
                <div class="login-wrap-box-pre">
                    <div class="title">
                        <p class="smalltitle">智慧灯控平台</p>
                    </div>
                    <div class="logininput">
                        <div class="logininput-box">
                            <input type="text" placeholder="用户名"  autocomplete='off' name="passport" >
                        </div>
                        <div class="logininput-box">
                            <input type="password" placeholder="密码" name="pwd">
                        </div>
                        <div class="logininput-box">
                            <input type="text" placeholder="验证码" name="checkCode">
                            <img id="checkCodeImg" src="/public/checkCode.do" alt="点击刷新" onclick="javascript:this.src='/public/checkCode.do?'+Math.random()">
                        </div>
                        <div class="logininput-box logininput-box-btn btn-lg">
                            立即登录
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--<div class="body-container">-->
        <!--&lt;!&ndash;<img src="/frame/login/img/bodyleft.png" class="body_bgd">&ndash;&gt;-->
        <!--<form role="form" onsubmit="return false;" style="height: auto;" class="login-form">-->
            <!--&lt;!&ndash;<div class="language">&ndash;&gt;-->
                <!--&lt;!&ndash;<span class="glyphicon glyphicon-globe"></span>&ndash;&gt;-->
                <!--&lt;!&ndash;<span>语言</span>&ndash;&gt;-->
            <!--&lt;!&ndash;</div>&ndash;&gt;-->
            <!--<h3>用户登录</h3>-->
            <!--&lt;!&ndash;<select id="dbCode" name="dbCode" class="form-control">&ndash;&gt;-->
                <!--&lt;!&ndash;&lt;!&ndash;<option>云平台账套</option>&ndash;&gt;&ndash;&gt;-->
            <!--&lt;!&ndash;</select>&ndash;&gt;-->
            <!--<div class="form-group">-->
                <!--<div class="input-group">-->
                    <!--<div class="input-group-addon login_icon"><span class="glyphicon glyphicon-user"></span></div>-->
                    <!--<input name="passport" class="form-control" type="text" placeholder="请输入用户名">-->
                <!--</div>-->
            <!--</div>-->

            <!--<div class="form-group">-->
                <!--<div class="input-group">-->
                    <!--<div class="input-group-addon login_icon"><span class="glyphicon glyphicon-lock"></span></div>-->
                    <!--<input name="pwd" class="form-control" type="password" placeholder="请输入密码">-->
                <!--</div>-->
            <!--</div>-->

            <!--<div class="form-group">-->
                <!--<div class="input-group">-->
                    <!--<div class="input-group-addon login_icon"><span class="glyphicon glyphicon-pencil"></span></div>-->
                    <!--<input name="checkCode" class="form-control" autocomplete="off" type="text" placeholder="请输入验证码" style="display: inline-block;width: 70%">-->
                    <!--<img id="checkCodeImg" src="/public/checkCode.do" alt="点击刷新" onclick="javascript:this.src='/public/checkCode.do?'+Math.random()" style="cursor:pointer; vertical-align:middle; width:28%; height:33px; margin-left:5px;display: inline-block;float: right"/>-->
                <!--</div>-->
            <!--</div>-->
            <!--<div class="login-btn">-->
                <!--<button type="submit" class="btn btn-lg">登录</button>-->
            <!--</div>-->
            <!--<div class="form-footer clearfix">-->
            <!--&lt;!&ndash;<a href="javascript:void(0);" class="fl" id="findPsw">找回密码</a>&ndash;&gt;-->
            <!--&lt;!&ndash;<a href="#">没有帐号，立即注册</a>&ndash;&gt;-->
            <!--</div>-->
        <!--</form>-->
        <!--&lt;!&ndash;找回密码&ndash;&gt;-->
        <!--<form role="form" onsubmit="return false;" style="height: 220px;display: none" class="find-form">-->
            <!--<h3>找回密码</h3>-->
            <!--<div class="form-group">-->
                <!--<div class="input-group">-->
                    <!--<div class="input-group-addon login_icon" style="padding: 8px"><span class="glyphicon glyphicon-envelope"></span></div>-->
                    <!--<input name="email" id="eamil" class="form-control" type="text" placeholder="请输入注册邮箱">-->
                <!--</div>-->
            <!--</div>-->
            <!--<div class="login-btn">-->
                <!--<button type="submit" class="btn  confirm">确定</button>-->
            <!--</div>-->
        <!--</form>-->
    <!--</div>-->
</div>

<script src="/system/common/libs/js/jquery.min.js"></script>
<script src="/system/common/custom/js/jquery.cookie.js"></script>
<script src="/system/common/libs/bootstrap/js/bootstrap.min.js"></script>
<script src="/system/common/libs/layer/layer.js"></script>
<script src="/system/common/libs/layer/layui.js"></script>
<script src="/system/common/libs/toastr/toastr.min.js"></script>
<script src="/system/common/custom/js/common.js"></script>

<script src="/system/common/custom/js/jquery.cookie.js"></script>
<!--以上内部不能动,以下为你自己的控件引入的内容-->
<script src="/system/common/custom/js/hashmap.js"></script>
<!--自定义控件css和js-->
<!--自定义控件css和js-->
<link rel="stylesheet" href="/system/common/libs/ztree/css/zTreeStyle/zTreeStyle.css" type="text/css">

<script src="/system/common/libs/ztree/js/jquery.ztree.all.min.js"></script>
<script src="/system/common/widget/x_win_tree/x_win_tree.js"></script>
<script src="/system/common/custom/js/globalApi.js"></script>
<script src="/system/common/custom/js/framedata.js"></script>
<script src="/system/common/custom/js/frameEvent.js"></script>

<script>
    $(function() {
        //调用：
        // 对Date的扩展，将 Date 转化为指定格式的String
        // 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符，
        // 年(y)可以用 1-4 个占位符，毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
        // 例子：
        // (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
        // (new Date()).Format("yyyy-M-d h:m:s.S")      ==> 2006-7-2 8:9:4.18
        Date.prototype.Format = function (fmt) { //author: meizz
            var o = {
                "M+": this.getMonth() + 1, //月份
                "d+": this.getDate(), //日
                "h+": this.getHours(), //小时
                "m+": this.getMinutes(), //分
                "s+": this.getSeconds(), //秒
                "q+": Math.floor((this.getMonth() + 3) / 3), //季度
                "S": this.getMilliseconds() //毫秒
            };
            if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
            for (var k in o)
                if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
            return fmt;
        }

        $(".btn-lg").on("click", function () {
            login();
        });
        //获取账套
        jQuery.ajax({
            url: '/system/common/public/dbList.do',
            success: function (res) {
                if (res) {
                    $.each(res, function (index, item) {
                        $("#dbCode").append("<option value='" + item.code + "'>" + item.title + "</option>");
                    });
                } else {
                    $.x_alertMsg("账套配置异常,请联系管理员。");
                }
            }
        });
        $(document).on("keyup", function (event) {
            if (event.keyCode === 13 ) {
                login();
            }
        });
        //找回密码
        $("#findPsw").on("click", function () {
            $(".login-form").hide();
            $(".find-form").show();
        });
        $(".confirm").on("click", function () {
            jQuery.ajax({
                url: '/public/sendEmailToChangePassword.do',
                data: 'email=' + $('#eamil').val(),
                success: function (res) {
                    $(".find-form").hide();
                    $(".login-form").show();
                }
            });
        });

        var flag = false;
        function login() {
            if (flag) return;
            flag = true;

            var passport = $("input[name='passport']").val();
            var pwd = $("input[name='pwd']").val();
            var checkCode = $("input[name='checkCode']").val();
            var dbCode = $("#dbCode").val();
            if (passport && pwd && checkCode) {
                jQuery.ajax({
                    url: '/public/login.do', data: {passport: passport, pwd: pwd, checkCode: checkCode, dbCode: dbCode},
                    success: function (res) {
                        if (res) {
                            if (res.status == "1") {
                                //部门选择rows:{{name:"",oid:""},{name:"",oid:""}}

                                if (res.data.orgList) {
                                    var orgs = "";
                                    var list = res.data.orgList;
                                    if (list.length > 1) {
                                        for (var i = 0; i < list.length; i++) {
                                            if (i == 0) {
                                                orgs += '<li><input type="radio" name="deptid" checked="true" value="' + list[i].oid + '">&nbsp;&nbsp; <span>' + list[i].orgName + '</span> </li>';
                                            } else {
                                                orgs += '<li><input type="radio" name="deptid" value="' + list[i].oid + '">&nbsp;&nbsp; <span>' + list[i].orgName + '</span> </li>';
                                            }
                                        }

                                        layer.open({
                                            type: 1,
                                            title: '部门选择',
                                            closeBtn: 1,
                                            btn: ['确定', '取消'],
                                            shadeClose: false,
                                            area: ["300px", "300px"],
                                            content: '<ul class="login-dept-choose" style="list-style-type:none">' + orgs + '</ul>',
                                            success: function (layero, index) {
                                                $("input[name='checkCode']").blur();
                                                $(layero).find(".login-dept-choose").on("click", "li", function () {
                                                    var input = $(this).find("input");
                                                    if (input.prop("checked") == false) {
                                                        input.prop("checked", true);
                                                    }
                                                });
                                            },
                                            yes: function (index, layero) {
                                                //选择后，调用api： /system/base/user/setOrg.do    oid
                                                var orgId = $(layero).find(".login-dept-choose input[name='deptid']:checked").val();
                                                if (orgId) {
                                                    jQuery.ajax({
                                                        url: '/system/user/setOrg.do', data: {oid: orgId},
                                                        success: function (res) {
                                                            if (res.status == "1") {
                                                                location.href = '/index.html';
                                                            } else {
                                                                GlobalApi.alertMsg("部门验证失败,请重试!");
                                                            }
                                                        }
                                                    });
                                                    //layer.close(index); //如果设定了yes回调，需进行手工关闭
                                                } else {
                                                    GlobalApi.alertMsg("请选择部门后再提交!");
                                                }
                                            },
                                            cancel: function (index, layero) {
                                                layer.close(index)
                                            }
                                        });
                                    } else {
                                        location.href = '/index.html';
                                    }
                                } else {
                                    location.href = '/index.html';
                                }
                            } else {
                                if (res.code == "stop") {
                                    $.x_alertMsg("账号已经暂停使用，联系管理员!");
                                } else if (res.code == "noUser") {
                                    $.x_alertMsg("账号没有用户!");
                                } else if (res.code == "noOrg") {
                                    $.x_alertMsg("没有分配部门!");
                                } else if (res.code == "errCode") {
                                    $.x_alertMsg("验证码错误，请重新输入验证码!");
                                } else {
                                    $.x_alertMsg("账号验证失败!");
                                }
                                $("#checkCodeImg").attr("src", '/public/checkCode.do?' + Math.random());
                            }
                        }
                    },
                    error: function () {
                        $("#checkCodeImg").attr("src", '/public/checkCode.do?' + Math.random());
                    },
                    complete: function() {
                        flag = false;
                    }
                });
            } else {
                $.x_alertMsg("请完善登录信息,再提交!");
                flag = false;
            }
        }
    });
</script>
</body>
</html>